import http from '@/utils/http'
/** 文件资源统计信息 */

export interface QueryRequest {
    name?: string
    type?: string
}
export interface FileStatisticsResp {
    type: any
    size: any
    number: number
    unit?: string
    data?: Array<FileStatisticsResp>
}



/** 系统文件类型 */
export interface QueryResponse {
    id: number
    adapter: string
    name: string
    length: number
    url: string
    directory: number
    type: number
    mime_type: number
    extension: string
    pid: number
    sort: number
    create_time: string
    update_time: string
    mark: number
}

/**
 * 查询列表(分页)
 */
export function getList(params: QueryRequest)  {
    return http.get<PageRes<QueryResponse[]>>('/admin/file/index', params)
}
/** @desc 查询文件资源统计统计 */
export function getFileStatistics() {
    return http.get<FileStatisticsResp>('/admin/file/statistics')
}


/** @desc 修改文件 */
export function updateFileName(name: String, id: number) {
    return http.post('/admin/file/rename', {id,name})
}
/**
 * 通过id数组批量删除数据
 */
export function batchDeleteRows(idList: Array<number>) {
    return http.post('/admin/file/delete', {
        id: idList,
    });
}
